from PyQt5.QtWidgets import *

from login_dialog import LoginDialog
from main_win import MainWin
from user_manager import User


app = QApplication([])
loginDialog = LoginDialog()
if loginDialog.exec_() == QDialog.Accepted:
    user = User.check_user(loginDialog.username(), loginDialog.password())
    if user is not None:
        win = MainWin(user)
        win.show()
        app.exec_()
    else:
        QMessageBox.critical(None, "提示", "登录失败了")
